package com.ayun.base;

import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

/**
 * @author 斌叔
 * @description: 普通测试类 TestJwt ，用于生成 token
 * @create 2022-05-09 13:17
 */
public class TestJwt {
    public static void main(String[] args) {
        String token = createJwt();
        System.out.println(token);
    }

    //生成token
    public static String createJwt() {

        JwtBuilder builder = Jwts.builder().setId("1")
                .setSubject("admin")
                .setIssuedAt(new java.util.Date())
                .signWith(SignatureAlgorithm.HS256, "123456");

        return builder.compact();

    }
}
